<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Insert title here</title>
    <link rel="stylesheet" type="text/css" href="css/page.css">
    <script type="text/javascript">
        function yunxu(){
            if(confirm("确定此报修信息完成?")){
                return true;
            }return false;
        }
        function buyunxu(){
            alert("已完成！不允许修改!")
            return false;
        }
    </script>
</head>
<body>
<%@include file="head.jsp" %>
<div class="bg1">
    <ul>
        <li><a href="${pageContext.request.contextPath}/listProperty"><input type="button" value="报修信息" class="button2"/></a></li><br/>
        <li><a href="${pageContext.request.contextPath}/propertyAddJSP"><input type="button" value="添加报修信息" class="button1"/></a></li><br/>
    </ul>
</div>
<div class="bg2">
    <form action="${pageContext.request.contextPath}/propertyFind" method="post">
        宿舍信息：<input type="text" name="building" class="text1"/>号楼
        <input type="text" name="floor" class="text1"/>层
        <input type="text" name="dorm" class="text1"/>号
        <input type="text" name="bed" class="text1"/>号床&nbsp;&nbsp;&nbsp;
        <input type="submit" value="查询" class="button"/>
    </form>
    <c:choose><c:when test="${!empty list}">
        <table border="1px" cellspacing="0" width="100%">
            <tr>
                <th>宿舍信息</th> <th>报修信息</th> <th>状态</th>
                <th>提交时间</th> <th>完成时间</th> <th>修改状态</th>
            </tr>
            <c:forEach var="p" items="${list}">
                <tr>
                    <td>${p.building}号楼${p.floor}层${p.dorm}号${p.bed}号床</td>
                    <td>${p.message}</td><td>${p.status}</td>
                    <td>${p.ntime}</td><td>${p.ytime}</td>
                    <td><c:if test="${p.status=='未完成'}">
                        <a href="${pageContext.request.contextPath}/propertyAlter?id=${p.id}"  onClick="return yunxu();">
                            <img src="./images/edit.jpg" width="20px" height="20px"/></a>
                    </c:if><c:if test="${p.status=='已完成'}">
                        <a href="PropertyAlter?id=${p.id}"  onClick="return buyunxu();">
                            <img src="./images/edit.jpg" width="20px" height="20px"/></a>
                    </c:if>
                    </td>
                </tr></c:forEach>
        </table></c:when>
        <c:otherwise>没有任何信息！</c:otherwise></c:choose>
</div>
</body>
</html>